#set working directory
setwd ("/home1/55/jc224266/working/fire")

#data file
bkgd.file = 'bkgd.fire.weather.csv'
occur.file = 'occurfile0409_maxent.csv'



################################################################################
# do something

#read in the occurrence file
occur = read.csv(occur.file)
bkgd = read.csv(bkgd.file)
bootstrap = 1:2

for (tfile in bootstrap)  {
  occur1 = occur[sample(1:nrow(occur), 80000),]; write.csv(occur1, paste("occur",tfile, ".csv", sep=""),row.names=F) 
  bkgd1 = bkgd[sample(1:nrow(bkgd), 120000),]; write.csv(bkgd, paste("bkgd",tfile, ".csv", sep=""),row.names=F) 
  out.dir = paste('outputa',tfile,'/',sep='');dir.create(out.dir)
  system(paste('java -mx1024m -jar maxent.jar -o output',tfile,' -e bkgd',tfile,'.csv -s occur',tfile,'.csv novisible autorun -j /home1/31/jc165798/Climate/AWAP.direct.download/summaries/Oz/monthly.mxe/',sep=''))  }


 